Gaussian highpass filter, page 285.
$ H(u,v) = 1 - e^{\frac{-D^2(u,v)}{2D_0}} $
In [1]:
%run ../common.ipynb
from __future__ import division
image = imread('../MP.tiff')
F = fft2(image)
In [2]:
D = 100
y,x = F.shape
X,Y = meshgrid(range(x), range(y))
H = 1 - numpy.exp(-((X-x/2)**2 + (Y-y/2)**2)/2/D**2)
gimshow(H)
In [3]:
G = fftshift(F)*H
G = ifftshift(G)
g = ifft2(G).real
gimshow(g)
In [5]:
g[g < 0] = 0
imsave('hp-gaussian.tif', g.astype(np.uint8))